package com.zp.self.producer;

import com.zp.self.entity.ProduceMessage;
import org.apache.rocketmq.client.producer.SendResult;

/**
 * @author yuyang
 * 生产消息的服务接口
 */
public interface ProduceService {

    /**
     * 发送同步消息
     * @param produceMessage 消息详情
     */
    SendResult sendSyncMsg(ProduceMessage produceMessage) throws Exception;

    /**
     * 发送异步消息
     * @param produceMessage 消息详情
     */
    void sendAsyncMsg(ProduceMessage produceMessage) throws Exception;

    /**
     * 发送事务消息
     * @param produceMessage 消息详情
     */
    SendResult sendTransactionMsg(ProduceMessage produceMessage) throws Exception;

    /**
     * 发送顺序消息
     * @param produceMessage 消息详情
     */
    SendResult sendMsgOrder(ProduceMessage produceMessage, int orderId) throws Exception;

    /**
     * 单向消息
     * @param produceMessage 消息详情
     */
    void sendOneWayMsg(ProduceMessage produceMessage) throws Exception;

}
